import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();        // 物品数量
        float M = in.nextFloat();    // 背包容量
        float[] w = new float[n];    // 物品重量数组
        int[] p = new int[n];        // 物品价值数组

        // 输入重量和价值
        for (int i = 0; i < n; i++) {
            w[i] = in.nextFloat();
        }
        for (int i = 0; i < n; i++) {
            p[i] = in.nextInt();
        }

        // 创建索引数组，并根据单位价值（v/w）降序排序
        Integer[] indices = new Integer[n];
        for (int i = 0; i < n; i++) {
            indices[i] = i;
        }

        // 自定义排序：按单位价值降序排列
        Arrays.sort(indices, new Comparator<Integer>() {
            @Override
            public int compare(Integer a, Integer b) {
                float ratioA = (float) p[a] / w[a];
                float ratioB = (float) p[b] / w[b];
                return Float.compare(ratioB, ratioA); // 降序排序
            }
        });

        float totalValue = 0;
        float remaining = M;

        // 贪心选择：优先装单位价值高的物品
        for (int j = 0; j < n; j++) {
            int i = indices[j]; // 当前物品的原始索引
            if (remaining <= 0) break;
            float weight = w[i];
            int value = p[i];
            if (weight <= remaining) {
                // 全部装入
                totalValue += value;
                remaining -= weight;
            } else {
                // 部分装入
                totalValue += (remaining / weight) * value;
                remaining = 0;
            }
        }

        System.out.printf("%.2f\n", totalValue);
    }
}